|
|
|
|
|
|
|
Listing 21.19. Coding the properties for the modUsrObject.bas module. |
|
|
|
|
|
|
|
|
Option Explicit
'
Private strLocalUserID As String
Public Property Get strUserIDSaved() As Variant
strUserIDSaved = strLocalUserID
End Property
Public Property Let strUserIDSaved(ByVal vNewValue As Variant)
strLocalUserID = vNewValue
End Property |
|
|
|
|
|
|
|
|
That's all the coding you need to do in the DLL project for now. Before continuing, save this project (PRJUSEROBJEC.VBP) and all its components. |
|
|
|
|
|
|
|
|
Now you need to modify the Main procedure in the test project you created earlier to call the new User Login form. Modify the Main routine to match the lines of code in Listing 21.20. |
|
|
|
|
|
|
|
|
Listing 21.20. Modifying the Main routine to add the new User Login form. |
|
|
|
|
|
|
|
|
Public Sub Main()
'
' main entry for form-less project
'
Set objUser = New usrObject
objUser.DBName = App.Path & "\..\..\data\security\security.mdb"
'
' now try to start up
If objUser.UserLogin = True Then
objUser.UsersForm
objUser.LogUser urLogOut
Else
MsgBox "You do not have rights to this application", vbExclamation,
"Login Failed"
End If
'
End
'
End Sub |
|
|
|
|
|
|
|
|
Now, instead of just calling the UsersForm routine right away, you first make the user login with a valid ID and password. If the user successfully logs in, the program runs the UsersForm routine. When the user returns from the User Maintenance form, the LogUser method is called with the urLogOut parameter. This updates the LastLogOut field of the secUsers table. |
|
|
|
|
|
|
|
|
Save and run this project. Your screen should look similar to the one in Figure 21.4. |
|
|
|
|
|